﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ChatData;
using Server;

namespace Client
{

    public delegate void SaveEventhandler(Object e ,ChatEventArgs<FilePost>eventargs);
    public delegate void ForwardEventHandler(Object e, ChatEventArgs<FilePost> eventargs);

    public delegate void PostEventhandler(Object e,DataEventArgs<Post> eventargs);
    public delegate void PostReplyEventhandler(Object e, ReplyChatEventArgs<Post> eventargs);
    public delegate void DMPostEventhandler(Object e, ReplyChatEventArgs<DMPost> eventargs);
    public delegate void FileEventhandler(Object e, DataEventArgs<FilePost> eventargs);
    public delegate void FileReplyEventhandler(Object e, ReplyChatEventArgs<FilePost> eventargs);
    public delegate void FileSaveEventhandler(Object e, FileSaveEventArgs<FilePost> eventargs);
    public delegate void StatusChangedEventhandler(Object e, DataEventArgs<String> eventargs);
        
        public class DataEventArgs<T> : EventArgs
        {
            public T Data { get; private set; }
            public EventType Type { get; private set; }

            public DataEventArgs(T newdata, EventType type)
            {
                Data = newdata;
                Type = type;
            }
        }
        public class ChatEventArgs<T>:EventArgs 
        {
            public T Data { get; protected set; }

            public ChatEventArgs()
            {}
            public ChatEventArgs(T thedata)
            {
                Data = thedata;
            }
        }
        public class FileSaveEventArgs<T> : ChatEventArgs<T> where T : IGetTime
        {
            public String Destination { get; set; }
            public FileSaveEventArgs(T thedata, String dest)
            {
                this.Data = thedata;
                this.Destination = dest;
            }
        }
        public class ReplyChatEventArgs<T> : ChatEventArgs<T> where T : IGetTime
        {
            public String Destination { get; set; }

            public ReplyChatEventArgs(T thedata, String dest)
            {
                this.Data = thedata;
                this.Destination = dest;
            }

        }

        public enum EventType
        {
            Open,
            Reply,
            Forward,
            Save,
            Status,
        }
}
